Including _-prefixing the API to reduce unwanted exports.
gailbooleancell.c \
gtkboxaccessible.c \
gtkbuttonaccessible.c \
- gailcell.c \
+ gtkcellaccessible.c \
gailcellparent.c \
gtkcheckmenuitemaccessible.c \
gtkchecksubmenuitemaccessible.c \
gailbooleancell.h \
gtkboxaccessible.h \
gtkbuttonaccessible.h \
- gailcell.h \
+ gtkcellaccessible.h \
gailcellparent.h \
gtkcheckmenuitemaccessible.h \
gtkchecksubmenuitemaccessible.h \
/* Update cell's state */
if (new_boolean)
- gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_CHECKED, emit_change_signal);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, emit_change_signal);
else
- gail_cell_remove_state (GAIL_CELL (cell), ATK_STATE_CHECKED, emit_change_signal);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, emit_change_signal);
}
if (boolean_cell->cell_sensitive != new_sensitive)
/* Update cell's state */
if (new_sensitive)
- gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, emit_change_signal);
else
- gail_cell_remove_state (GAIL_CELL (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, emit_change_signal);
}
return rv;
+++ /dev/null
-/* GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include "gailcontainercell.h"
-#include "gailcell.h"
-#include "gailcellparent.h"
-
-static void gail_cell_class_init (GailCellClass *klass);
-static void gail_cell_destroyed (GtkWidget *widget,
- GailCell *cell);
-
-static void gail_cell_init (GailCell *cell);
-static void gail_cell_object_finalize (GObject *cell);
-static AtkStateSet* gail_cell_ref_state_set (AtkObject *obj);
-static gint gail_cell_get_index_in_parent (AtkObject *obj);
-
-/* AtkAction */
-
-static void atk_action_interface_init
- (AtkActionIface *iface);
-static ActionInfo * _gail_cell_get_action_info (GailCell *cell,
- gint index);
-static void _gail_cell_destroy_action_info
- (gpointer data,
- gpointer user_data);
-
-static gint gail_cell_action_get_n_actions
- (AtkAction *action);
-static const gchar*
- gail_cell_action_get_name (AtkAction *action,
- gint index);
-static const gchar *
- gail_cell_action_get_description
- (AtkAction *action,
- gint index);
-static const gchar *
- gail_cell_action_get_keybinding
- (AtkAction *action,
- gint index);
-static gboolean gail_cell_action_do_action (AtkAction *action,
- gint index);
-
-static void atk_component_interface_init (AtkComponentIface *iface);
-static void gail_cell_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type);
-static gboolean gail_cell_grab_focus (AtkComponent *component);
-
-G_DEFINE_TYPE_WITH_CODE (GailCell, gail_cell, ATK_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
-
-static void
-gail_cell_class_init (GailCellClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
-
- g_object_class->finalize = gail_cell_object_finalize;
-
- class->get_index_in_parent = gail_cell_get_index_in_parent;
- class->ref_state_set = gail_cell_ref_state_set;
-}
-
-void
-gail_cell_initialise (GailCell *cell,
- GtkWidget *widget,
- AtkObject *parent,
- gint index)
-{
- g_return_if_fail (GAIL_IS_CELL (cell));
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- cell->widget = widget;
- atk_object_set_parent (ATK_OBJECT (cell), parent);
- cell->index = index;
-
- g_signal_connect_object (G_OBJECT (widget),
- "destroy",
- G_CALLBACK (gail_cell_destroyed ),
- cell, 0);
-}
-
-static void
-gail_cell_destroyed (GtkWidget *widget,
- GailCell *cell)
-{
- /*
- * This is the signal handler for the "destroy" signal for the
- * GtkWidget. We set the pointer location to NULL;
- */
- cell->widget = NULL;
-}
-
-static void
-gail_cell_init (GailCell *cell)
-{
- cell->state_set = atk_state_set_new ();
- cell->widget = NULL;
- cell->action_list = NULL;
- cell->index = 0;
- atk_state_set_add_state (cell->state_set, ATK_STATE_TRANSIENT);
- atk_state_set_add_state (cell->state_set, ATK_STATE_ENABLED);
- atk_state_set_add_state (cell->state_set, ATK_STATE_SENSITIVE);
- atk_state_set_add_state (cell->state_set, ATK_STATE_SELECTABLE);
- cell->refresh_index = NULL;
-}
-
-static void
-gail_cell_object_finalize (GObject *obj)
-{
- GailCell *cell = GAIL_CELL (obj);
- AtkRelationSet *relation_set;
- AtkRelation *relation;
- GPtrArray *target;
- gpointer target_object;
- gint i;
-
- if (cell->state_set)
- g_object_unref (cell->state_set);
- if (cell->action_list)
- {
- g_list_foreach (cell->action_list, _gail_cell_destroy_action_info, NULL);
- g_list_free (cell->action_list);
- }
- relation_set = atk_object_ref_relation_set (ATK_OBJECT (obj));
- if (ATK_IS_RELATION_SET (relation_set))
- {
- relation = atk_relation_set_get_relation_by_type (relation_set,
- ATK_RELATION_NODE_CHILD_OF);
- if (relation)
- {
- target = atk_relation_get_target (relation);
- for (i = 0; i < target->len; i++)
- {
- target_object = g_ptr_array_index (target, i);
- if (GAIL_IS_CELL (target_object))
- {
- g_object_unref (target_object);
- }
- }
- }
- g_object_unref (relation_set);
- }
- G_OBJECT_CLASS (gail_cell_parent_class)->finalize (obj);
-}
-
-static AtkStateSet *
-gail_cell_ref_state_set (AtkObject *obj)
-{
- GailCell *cell = GAIL_CELL (obj);
- g_assert (cell->state_set);
-
- g_object_ref(cell->state_set);
- return cell->state_set;
-}
-
-gboolean
-gail_cell_add_state (GailCell *cell,
- AtkStateType state_type,
- gboolean emit_signal)
-{
- if (!atk_state_set_contains_state (cell->state_set, state_type))
- {
- gboolean rc;
- AtkObject *parent;
-
- rc = atk_state_set_add_state (cell->state_set, state_type);
- /*
- * The signal should only be generated if the value changed,
- * not when the cell is set up. So states that are set
- * initially should pass FALSE as the emit_signal argument.
- */
-
- if (emit_signal)
- {
- atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE);
- /* If state_type is ATK_STATE_VISIBLE, additional notification */
- if (state_type == ATK_STATE_VISIBLE)
- g_signal_emit_by_name (cell, "visible_data_changed");
- }
-
- /*
- * If the parent is a flyweight container cell, propagate the state
- * change to it also
- */
-
- parent = atk_object_get_parent (ATK_OBJECT (cell));
- if (GAIL_IS_CONTAINER_CELL (parent))
- gail_cell_add_state (GAIL_CELL (parent), state_type, emit_signal);
- return rc;
- }
- else
- return FALSE;
-}
-
-gboolean
-gail_cell_remove_state (GailCell *cell,
- AtkStateType state_type,
- gboolean emit_signal)
-{
- if (atk_state_set_contains_state (cell->state_set, state_type))
- {
- gboolean rc;
- AtkObject *parent;
-
- parent = atk_object_get_parent (ATK_OBJECT (cell));
-
- rc = atk_state_set_remove_state (cell->state_set, state_type);
- /*
- * The signal should only be generated if the value changed,
- * not when the cell is set up. So states that are set
- * initially should pass FALSE as the emit_signal argument.
- */
-
- if (emit_signal)
- {
- atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE);
- /* If state_type is ATK_STATE_VISIBLE, additional notification */
- if (state_type == ATK_STATE_VISIBLE)
- g_signal_emit_by_name (cell, "visible_data_changed");
- }
-
- /*
- * If the parent is a flyweight container cell, propagate the state
- * change to it also
- */
-
- if (GAIL_IS_CONTAINER_CELL (parent))
- gail_cell_remove_state (GAIL_CELL (parent), state_type, emit_signal);
- return rc;
- }
- else
- return FALSE;
-}
-
-static gint
-gail_cell_get_index_in_parent (AtkObject *obj)
-{
- GailCell *cell;
-
- g_assert (GAIL_IS_CELL (obj));
-
- cell = GAIL_CELL (obj);
- if (atk_state_set_contains_state (cell->state_set, ATK_STATE_STALE))
- if (cell->refresh_index)
- {
- cell->refresh_index (cell);
- atk_state_set_remove_state (cell->state_set, ATK_STATE_STALE);
- }
- return cell->index;
-}
-
-static void
-atk_action_interface_init (AtkActionIface *iface)
-{
- iface->get_n_actions = gail_cell_action_get_n_actions;
- iface->do_action = gail_cell_action_do_action;
- iface->get_name = gail_cell_action_get_name;
- iface->get_description = gail_cell_action_get_description;
- iface->get_keybinding = gail_cell_action_get_keybinding;
-}
-
-gboolean
-gail_cell_add_action (GailCell *cell,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding,
- ACTION_FUNC action_func)
-{
- ActionInfo *info;
- g_return_val_if_fail (GAIL_IS_CELL (cell), FALSE);
- info = g_new (ActionInfo, 1);
-
- if (action_name != NULL)
- info->name = g_strdup (action_name);
- else
- info->name = NULL;
- if (action_description != NULL)
- info->description = g_strdup (action_description);
- else
- info->description = NULL;
- if (action_keybinding != NULL)
- info->keybinding = g_strdup (action_keybinding);
- else
- info->keybinding = NULL;
- info->do_action_func = action_func;
-
- cell->action_list = g_list_append (cell->action_list, (gpointer) info);
- return TRUE;
-}
-
-gboolean
-gail_cell_remove_action (GailCell *cell,
- gint action_index)
-{
- GList *list_node;
-
- g_return_val_if_fail (GAIL_IS_CELL (cell), FALSE);
- list_node = g_list_nth (cell->action_list, action_index);
- if (!list_node)
- return FALSE;
- _gail_cell_destroy_action_info (list_node->data, NULL);
- cell->action_list = g_list_remove_link (cell->action_list, list_node);
- return TRUE;
-}
-
-
-gboolean
-gail_cell_remove_action_by_name (GailCell *cell,
- const gchar *action_name)
-{
- GList *list_node;
- gboolean action_found= FALSE;
-
- g_return_val_if_fail (GAIL_IS_CELL (cell), FALSE);
- for (list_node = cell->action_list; list_node && !action_found;
- list_node = list_node->next)
- {
- if (!strcmp (((ActionInfo *)(list_node->data))->name, action_name))
- {
- action_found = TRUE;
- break;
- }
- }
- if (!action_found)
- return FALSE;
- _gail_cell_destroy_action_info (list_node->data, NULL);
- cell->action_list = g_list_remove_link (cell->action_list, list_node);
- return TRUE;
-}
-
-static ActionInfo *
-_gail_cell_get_action_info (GailCell *cell,
- gint index)
-{
- GList *list_node;
-
- g_return_val_if_fail (GAIL_IS_CELL (cell), NULL);
- if (cell->action_list == NULL)
- return NULL;
- list_node = g_list_nth (cell->action_list, index);
- if (!list_node)
- return NULL;
- return (ActionInfo *) (list_node->data);
-}
-
-
-static void
-_gail_cell_destroy_action_info (gpointer action_info,
- gpointer user_data)
-{
- ActionInfo *info = (ActionInfo *)action_info;
- g_assert (info != NULL);
- g_free (info->name);
- g_free (info->description);
- g_free (info->keybinding);
- g_free (info);
-}
-static gint
-gail_cell_action_get_n_actions (AtkAction *action)
-{
- GailCell *cell = GAIL_CELL(action);
- if (cell->action_list != NULL)
- return g_list_length (cell->action_list);
- else
- return 0;
-}
-
-static const gchar *
-gail_cell_action_get_name (AtkAction *action,
- gint index)
-{
- GailCell *cell = GAIL_CELL(action);
- ActionInfo *info = _gail_cell_get_action_info (cell, index);
-
- if (info == NULL)
- return NULL;
- return info->name;
-}
-
-static const gchar *
-gail_cell_action_get_description (AtkAction *action,
- gint index)
-{
- GailCell *cell = GAIL_CELL(action);
- ActionInfo *info = _gail_cell_get_action_info (cell, index);
-
- if (info == NULL)
- return NULL;
- return info->description;
-}
-
-static const gchar *
-gail_cell_action_get_keybinding (AtkAction *action,
- gint index)
-{
- GailCell *cell = GAIL_CELL(action);
- ActionInfo *info = _gail_cell_get_action_info (cell, index);
- if (info == NULL)
- return NULL;
- return info->keybinding;
-}
-
-static gboolean
-gail_cell_action_do_action (AtkAction *action,
- gint index)
-{
- GailCell *cell = GAIL_CELL(action);
- ActionInfo *info = _gail_cell_get_action_info (cell, index);
- if (info == NULL)
- return FALSE;
- if (info->do_action_func == NULL)
- return FALSE;
-
- info->do_action_func (cell);
-
- return TRUE;
-}
-
-static void
-atk_component_interface_init (AtkComponentIface *iface)
-{
- iface->get_extents = gail_cell_get_extents;
- iface->grab_focus = gail_cell_grab_focus;
-}
-
-static void
-gail_cell_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
-{
- GailCell *gailcell;
- AtkObject *cell_parent;
-
- g_assert (GAIL_IS_CELL (component));
-
- gailcell = GAIL_CELL (component);
-
- cell_parent = gtk_widget_get_accessible (gailcell->widget);
-
- gail_cell_parent_get_cell_extents (GAIL_CELL_PARENT (cell_parent),
- gailcell, x, y, width, height, coord_type);
-}
-
-static gboolean
-gail_cell_grab_focus (AtkComponent *component)
-{
- GailCell *gailcell;
- AtkObject *cell_parent;
-
- g_assert (GAIL_IS_CELL (component));
-
- gailcell = GAIL_CELL (component);
-
- cell_parent = gtk_widget_get_accessible (gailcell->widget);
-
- return gail_cell_parent_grab_focus (GAIL_CELL_PARENT (cell_parent),
- gailcell);
-}
+++ /dev/null
-/* GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GAIL_CELL_H__
-#define __GAIL_CELL_H__
-
-#include <atk/atk.h>
-
-G_BEGIN_DECLS
-
-#define GAIL_TYPE_CELL (gail_cell_get_type ())
-#define GAIL_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CELL, GailCell))
-#define GAIL_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CELL, GailCellClass))
-#define GAIL_IS_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CELL))
-#define GAIL_IS_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CELL))
-#define GAIL_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CELL, GailCellClass))
-
-typedef struct _GailCell GailCell;
-typedef struct _GailCellClass GailCellClass;
-typedef struct _ActionInfo ActionInfo;
-typedef void (*ACTION_FUNC) (GailCell *cell);
-
-struct _GailCell
-{
- AtkObject parent;
-
- GtkWidget *widget;
- /*
- * This cached value is used only by atk_object_get_index_in_parent()
- * which updates the value when it is stale.
- */
- gint index;
- AtkStateSet *state_set;
- GList *action_list;
- void (*refresh_index) (GailCell *cell);
-};
-
-GType gail_cell_get_type (void);
-
-struct _GailCellClass
-{
- AtkObjectClass parent_class;
-};
-
-struct _ActionInfo {
- gchar *name;
- gchar *description;
- gchar *keybinding;
- ACTION_FUNC do_action_func;
-};
-
-void gail_cell_initialise (GailCell *cell,
- GtkWidget *widget,
- AtkObject *parent,
- gint index);
-
-gboolean gail_cell_add_state (GailCell *cell,
- AtkStateType state_type,
- gboolean emit_signal);
-
-gboolean gail_cell_remove_state (GailCell *cell,
- AtkStateType state_type,
- gboolean emit_signal);
-
-gboolean gail_cell_add_action (GailCell *cell,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding,
- ACTION_FUNC action_func);
-
-gboolean gail_cell_remove_action (GailCell *cell,
- gint action_id);
-
-gboolean gail_cell_remove_action_by_name (GailCell *cell,
- const gchar *action_name);
-
-G_END_DECLS
-
-#endif /* __GAIL_CELL_H__ */
return g_define_type_id__volatile;
}
-/**
- * gail_cell_parent_get_cell_extents:
- * @parent: a #GObject instance that implements GailCellParentIface
- * @cell: a #GailCell whose extents is required
- * @x: address of #gint to put x coordinate
- * @y: address of #gint to put y coordinate
- * @width: address of #gint to put width
- * @height: address of #gint to put height
- * @coord_type: specifies whether the coordinates are relative to the screen
- * or to the components top level window
- *
- * Gets the rectangle which gives the extent of the @cell.
- *
- **/
void
-gail_cell_parent_get_cell_extents (GailCellParent *parent,
- GailCell *cell,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
+gail_cell_parent_get_cell_extents (GailCellParent *parent,
+ GtkCellAccessible *cell,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
{
GailCellParentIface *iface;
(iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type);
}
-/**
- * gail_cell_parent_get_cell_area:
- * @parent: a #GObject instance that implements GailCellParentIface
- * @cell: a #GailCell whose area is required
- * @cell_rect: address of #GdkRectangle to put the cell area
- *
- * Gets the cell area of the @cell.
- *
- **/
void
-gail_cell_parent_get_cell_area (GailCellParent *parent,
- GailCell *cell,
- GdkRectangle *cell_rect)
+gail_cell_parent_get_cell_area (GailCellParent *parent,
+ GtkCellAccessible *cell,
+ GdkRectangle *cell_rect)
{
GailCellParentIface *iface;
if (iface->get_cell_area)
(iface->get_cell_area) (parent, cell, cell_rect);
}
-/**
- * gail_cell_parent_grab_focus:
- * @parent: a #GObject instance that implements GailCellParentIface
- * @cell: a #GailCell whose area is required
- *
- * Puts focus in the specified cell.
- *
- **/
+
gboolean
-gail_cell_parent_grab_focus (GailCellParent *parent,
- GailCell *cell)
+gail_cell_parent_grab_focus (GailCellParent *parent,
+ GtkCellAccessible *cell)
{
GailCellParentIface *iface;
#define __GAIL_CELL_PARENT_H__
#include <atk/atk.h>
-#include "gailcell.h"
+#include "gtkcellaccessible.h"
G_BEGIN_DECLS
{
GTypeInterface parent;
void ( *get_cell_extents) (GailCellParent *parent,
- GailCell *cell,
+ GtkCellAccessible *cell,
gint *x,
gint *y,
gint *width,
gint *height,
AtkCoordType coord_type);
void ( *get_cell_area) (GailCellParent *parent,
- GailCell *cell,
+ GtkCellAccessible *cell,
GdkRectangle *cell_rect);
gboolean ( *grab_focus) (GailCellParent *parent,
- GailCell *cell);
+ GtkCellAccessible *cell);
};
GType gail_cell_parent_get_type (void);
void gail_cell_parent_get_cell_extents (GailCellParent *parent,
- GailCell *cell,
+ GtkCellAccessible *cell,
gint *x,
gint *y,
gint *width,
AtkCoordType coord_type
);
void gail_cell_parent_get_cell_area (GailCellParent *parent,
- GailCell *cell,
+ GtkCellAccessible *cell,
GdkRectangle *cell_rect);
gboolean gail_cell_parent_grab_focus (GailCellParent *parent,
- GailCell *cell);
+ GtkCellAccessible *cell);
G_END_DECLS
static void gail_container_cell_finalize (GObject *obj);
-static void _gail_container_cell_recompute_child_indices
+static void _gail_container_cell_recompute_child_indices
(GailContainerCell *container);
-static void gail_container_cell_refresh_child_index (GailCell *cell);
+static void gail_container_cell_refresh_child_index (GtkCellAccessible *cell);
static gint gail_container_cell_get_n_children (AtkObject *obj);
static AtkObject* gail_container_cell_ref_child (AtkObject *obj,
gint child);
-G_DEFINE_TYPE (GailContainerCell, gail_container_cell, GAIL_TYPE_CELL)
+G_DEFINE_TYPE (GailContainerCell, gail_container_cell, GTK_TYPE_CELL_ACCESSIBLE)
static void
gail_container_cell_class_init (GailContainerCellClass *klass)
G_OBJECT_CLASS (gail_container_cell_parent_class)->finalize (obj);
}
-
void
gail_container_cell_add_child (GailContainerCell *container,
- GailCell *child)
+ GtkCellAccessible *child)
{
gint child_index;
- g_return_if_fail (GAIL_IS_CONTAINER_CELL(container));
- g_return_if_fail (GAIL_IS_CELL(child));
+ g_return_if_fail (GAIL_IS_CONTAINER_CELL (container));
+ g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
child_index = container->NChildren++;
- container->children = g_list_append (container->children, (gpointer) child);
+ container->children = g_list_append (container->children, child);
child->index = child_index;
atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container));
child->refresh_index = gail_container_cell_refresh_child_index;
}
-
void
gail_container_cell_remove_child (GailContainerCell *container,
- GailCell *child)
+ GtkCellAccessible *child)
{
- g_return_if_fail (GAIL_IS_CONTAINER_CELL(container));
- g_return_if_fail (GAIL_IS_CELL(child));
+ g_return_if_fail (GAIL_IS_CONTAINER_CELL (container));
+ g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
g_return_if_fail (container->NChildren > 0);
- container->children = g_list_remove (container->children, (gpointer) child);
+ container->children = g_list_remove (container->children, child);
_gail_container_cell_recompute_child_indices (container);
container->NChildren--;
}
-
static void
_gail_container_cell_recompute_child_indices (GailContainerCell *container)
{
gint cur_index = 0;
- GList *temp_list;
-
- g_return_if_fail (GAIL_IS_CONTAINER_CELL(container));
+ GList *l;
- for (temp_list = container->children; temp_list; temp_list = temp_list->next)
+ for (l = container->children; l; l = l->next)
{
- GAIL_CELL(temp_list->data)->index = cur_index;
+ GTK_CELL_ACCESSIBLE (l->data)->index = cur_index;
cur_index++;
}
}
-
static void
-gail_container_cell_refresh_child_index (GailCell *cell)
+gail_container_cell_refresh_child_index (GtkCellAccessible *cell)
{
GailContainerCell *container;
- g_return_if_fail (GAIL_IS_CELL(cell));
- container = GAIL_CONTAINER_CELL (atk_object_get_parent (ATK_OBJECT(cell)));
- g_return_if_fail (GAIL_IS_CONTAINER_CELL (container));
- _gail_container_cell_recompute_child_indices (container);
-}
+ container = GAIL_CONTAINER_CELL (atk_object_get_parent (ATK_OBJECT (cell)));
+ _gail_container_cell_recompute_child_indices (container);
+}
static gint
gail_container_cell_get_n_children (AtkObject *obj)
return cell->NChildren;
}
-
static AtkObject *
gail_container_cell_ref_child (AtkObject *obj,
gint child)
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
#define __GAIL_CONTAINER_CELL_H__
#include <atk/atk.h>
-#include "gailcell.h"
+#include "gtkcellaccessible.h"
G_BEGIN_DECLS
struct _GailContainerCell
{
- GailCell parent;
+ GtkCellAccessible parent;
GList *children;
gint NChildren;
};
-GType gail_container_cell_get_type (void);
-
struct _GailContainerCellClass
{
- GailCellClass parent_class;
+ GtkCellAccessibleClass parent_class;
};
-GailContainerCell *
-gail_container_cell_new (void);
+GType gail_container_cell_get_type (void);
+
+GailContainerCell * gail_container_cell_new (void);
-void
-gail_container_cell_add_child (GailContainerCell *container,
- GailCell *child);
+void gail_container_cell_add_child (GailContainerCell *container,
+ GtkCellAccessible *child);
-void
-gail_container_cell_remove_child (GailContainerCell *container,
- GailCell *child);
+void gail_container_cell_remove_child (GailContainerCell *container,
+ GtkCellAccessible *child);
G_END_DECLS
-#endif /* __GAIL_TREE_VIEW_TEXT_CELL_H__ */
+#endif /* __GAIL_CONTAINER_CELL_H__ */
G_END_DECLS
-#endif /* __GAIL_TREE_VIEW_IMAGE_CELL_H__ */
+#endif /* __GAIL_IMAGE_CELL_H__ */
static void gail_renderer_cell_finalize (GObject *object);
-G_DEFINE_TYPE (GailRendererCell, gail_renderer_cell, GAIL_TYPE_CELL)
+G_DEFINE_TYPE (GailRendererCell, gail_renderer_cell, GTK_TYPE_CELL_ACCESSIBLE)
-static void
+static void
gail_renderer_cell_class_init (GailRendererCellClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
}
static void
-gail_renderer_cell_finalize (GObject *object)
+gail_renderer_cell_finalize (GObject *object)
{
GailRendererCell *renderer_cell = GAIL_RENDERER_CELL (object);
if (renderer_cell->renderer)
g_object_unref (renderer_cell->renderer);
+
G_OBJECT_CLASS (gail_renderer_cell_parent_class)->finalize (object);
}
gboolean
-gail_renderer_cell_update_cache (GailRendererCell *cell,
- gboolean emit_change_signal)
+gail_renderer_cell_update_cache (GailRendererCell *cell,
+ gboolean emit_change_signal)
{
- GailRendererCellClass *class = GAIL_RENDERER_CELL_GET_CLASS(cell);
+ GailRendererCellClass *class = GAIL_RENDERER_CELL_GET_CLASS (cell);
+
if (class->update_cache)
- return (class->update_cache)(cell, emit_change_signal);
+ return (class->update_cache) (cell, emit_change_signal);
+
return FALSE;
}
-AtkObject*
+AtkObject *
gail_renderer_cell_new (void)
{
GObject *object;
#define __GAIL_RENDERER_CELL_H__
#include <atk/atk.h>
-#include "gailcell.h"
+#include "gtkcellaccessible.h"
G_BEGIN_DECLS
#define GAIL_IS_RENDERER_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_RENDERER_CELL))
#define GAIL_RENDERER_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_RENDERER_CELL, GailRendererCellClass))
-typedef struct _GailRendererCell GailRendererCell;
-typedef struct _GailRendererCellClass GailRendererCellClass;
+typedef struct _GailRendererCell GailRendererCell;
+typedef struct _GailRendererCellClass GailRendererCellClass;
struct _GailRendererCell
{
- GailCell parent;
- GtkCellRenderer *renderer;
+ GtkCellAccessible parent;
+ GtkCellRenderer *renderer;
};
-GType gail_renderer_cell_get_type (void);
-
struct _GailRendererCellClass
{
- GailCellClass parent_class;
+ GtkCellAccessibleClass parent_class;
gchar **property_list;
- gboolean (*update_cache)(GailRendererCell *cell, gboolean emit_change_signal);
+ gboolean (*update_cache) (GailRendererCell *cell,
+ gboolean emit_change_signal);
};
-gboolean
-gail_renderer_cell_update_cache (GailRendererCell *cell, gboolean emit_change_signal);
+GType gail_renderer_cell_get_type (void);
-AtkObject *gail_renderer_cell_new (void);
+AtkObject *gail_renderer_cell_new (void);
+gboolean gail_renderer_cell_update_cache (GailRendererCell *cell,
+ gboolean emit_change_signal);
G_END_DECLS
-#endif /* __GAIL_TREE_VIEW_TEXT_CELL_H__ */
+#endif /* __GAIL_TEXT_CELL_H__ */
text_cell->cell_text = NULL;
text_cell->caret_pos = 0;
text_cell->cell_length = 0;
- atk_state_set_add_state (GAIL_CELL (text_cell)->state_set,
+ atk_state_set_add_state (GTK_CELL_ACCESSIBLE (text_cell)->state_set,
ATK_STATE_SINGLE_LINE);
}
parent = atk_object_get_parent (parent);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
g_return_if_fail (GAIL_IS_CELL_PARENT (parent));
- gail_cell_parent_get_cell_area (GAIL_CELL_PARENT (parent), GAIL_CELL (text),
+ gail_cell_parent_get_cell_area (GAIL_CELL_PARENT (parent), GTK_CELL_ACCESSIBLE (text),
&rendered_rect);
gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer),
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
g_return_val_if_fail (GAIL_IS_CELL_PARENT (parent), -1);
- gail_cell_parent_get_cell_area (GAIL_CELL_PARENT (parent), GAIL_CELL (text),
+ gail_cell_parent_get_cell_area (GAIL_CELL_PARENT (parent), GTK_CELL_ACCESSIBLE (text),
&rendered_rect);
gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer),
gint cell_length;
};
-GType gail_text_cell_get_type (void);
-
struct _GailTextCellClass
{
GailRendererCellClass parent_class;
};
-AtkObject *gail_text_cell_new (void);
+GType gail_text_cell_get_type (void);
+AtkObject *gail_text_cell_new (void);
G_END_DECLS
-#endif /* __GAIL_TREE_VIEW_TEXT_CELL_H__ */
+#endif /* __GAIL_TEXT_CELL_H__ */
--- /dev/null
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include "gailcontainercell.h"
+#include "gtkcellaccessible.h"
+#include "gailcellparent.h"
+
+typedef struct _ActionInfo ActionInfo;
+struct _ActionInfo {
+ gchar *name;
+ gchar *description;
+ gchar *keybinding;
+ void (*do_action_func) (GtkCellAccessible *cell);
+};
+
+
+static void atk_action_interface_init (AtkActionIface *iface);
+static void atk_component_interface_init (AtkComponentIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkCellAccessible, _gtk_cell_accessible, ATK_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
+
+static void
+destroy_action_info (gpointer action_info)
+{
+ ActionInfo *info = (ActionInfo *)action_info;
+
+ g_free (info->name);
+ g_free (info->description);
+ g_free (info->keybinding);
+ g_free (info);
+}
+
+static void
+gtk_cell_accessible_object_finalize (GObject *obj)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (obj);
+ AtkRelationSet *relation_set;
+ AtkRelation *relation;
+ GPtrArray *target;
+ gpointer target_object;
+ gint i;
+
+ if (cell->state_set)
+ g_object_unref (cell->state_set);
+
+ if (cell->action_list)
+ g_list_free_full (cell->action_list, destroy_action_info);
+
+ relation_set = atk_object_ref_relation_set (ATK_OBJECT (obj));
+ if (ATK_IS_RELATION_SET (relation_set))
+ {
+ relation = atk_relation_set_get_relation_by_type (relation_set,
+ ATK_RELATION_NODE_CHILD_OF);
+ if (relation)
+ {
+ target = atk_relation_get_target (relation);
+ for (i = 0; i < target->len; i++)
+ {
+ target_object = g_ptr_array_index (target, i);
+ if (GTK_IS_CELL_ACCESSIBLE (target_object))
+ g_object_unref (target_object);
+ }
+ }
+ g_object_unref (relation_set);
+ }
+ G_OBJECT_CLASS (_gtk_cell_accessible_parent_class)->finalize (obj);
+}
+
+static gint
+gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
+{
+ GtkCellAccessible *cell;
+
+ cell = GTK_CELL_ACCESSIBLE (obj);
+ if (atk_state_set_contains_state (cell->state_set, ATK_STATE_STALE) &&
+ cell->refresh_index != NULL)
+ {
+ cell->refresh_index (cell);
+ atk_state_set_remove_state (cell->state_set, ATK_STATE_STALE);
+ }
+
+ return cell->index;
+}
+
+static AtkStateSet *
+gtk_cell_accessible_ref_state_set (AtkObject *obj)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (obj);
+
+ g_object_ref (cell->state_set);
+
+ return cell->state_set;
+}
+
+static void
+_gtk_cell_accessible_class_init (GtkCellAccessibleClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+ GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
+
+ g_object_class->finalize = gtk_cell_accessible_object_finalize;
+
+ class->get_index_in_parent = gtk_cell_accessible_get_index_in_parent;
+ class->ref_state_set = gtk_cell_accessible_ref_state_set;
+}
+
+static void
+_gtk_cell_accessible_init (GtkCellAccessible *cell)
+{
+ cell->widget = NULL;
+ cell->action_list = NULL;
+ cell->index = 0;
+ cell->refresh_index = NULL;
+ cell->state_set = atk_state_set_new ();
+ atk_state_set_add_state (cell->state_set, ATK_STATE_TRANSIENT);
+ atk_state_set_add_state (cell->state_set, ATK_STATE_ENABLED);
+ atk_state_set_add_state (cell->state_set, ATK_STATE_SENSITIVE);
+ atk_state_set_add_state (cell->state_set, ATK_STATE_SELECTABLE);
+}
+
+static void
+widget_destroyed (GtkWidget *widget,
+ GtkCellAccessible *cell)
+{
+ cell->widget = NULL;
+}
+
+void
+_gtk_cell_accessible_initialise (GtkCellAccessible *cell,
+ GtkWidget *widget,
+ AtkObject *parent,
+ gint index)
+{
+ cell->widget = widget;
+ atk_object_set_parent (ATK_OBJECT (cell), parent);
+ cell->index = index;
+
+ g_signal_connect_object (G_OBJECT (widget), "destroy",
+ G_CALLBACK (widget_destroyed), cell, 0);
+}
+
+gboolean
+_gtk_cell_accessible_add_state (GtkCellAccessible *cell,
+ AtkStateType state_type,
+ gboolean emit_signal)
+{
+ gboolean rc;
+ AtkObject *parent;
+
+ if (atk_state_set_contains_state (cell->state_set, state_type))
+ return FALSE;
+
+ rc = atk_state_set_add_state (cell->state_set, state_type);
+
+ /* The signal should only be generated if the value changed,
+ * not when the cell is set up. So states that are set
+ * initially should pass FALSE as the emit_signal argument.
+ */
+ if (emit_signal)
+ {
+ atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE);
+ /* If state_type is ATK_STATE_VISIBLE, additional notification */
+ if (state_type == ATK_STATE_VISIBLE)
+ g_signal_emit_by_name (cell, "visible_data_changed");
+ }
+
+ /* If the parent is a flyweight container cell, propagate the state
+ * change to it also
+ */
+ parent = atk_object_get_parent (ATK_OBJECT (cell));
+ if (GAIL_IS_CONTAINER_CELL (parent))
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (parent), state_type, emit_signal);
+
+ return rc;
+}
+
+gboolean
+_gtk_cell_accessible_remove_state (GtkCellAccessible *cell,
+ AtkStateType state_type,
+ gboolean emit_signal)
+{
+ gboolean rc;
+ AtkObject *parent;
+
+ if (!atk_state_set_contains_state (cell->state_set, state_type))
+ return FALSE;
+
+ parent = atk_object_get_parent (ATK_OBJECT (cell));
+
+ rc = atk_state_set_remove_state (cell->state_set, state_type);
+
+ /* The signal should only be generated if the value changed,
+ * not when the cell is set up. So states that are set
+ * initially should pass FALSE as the emit_signal argument.
+ */
+ if (emit_signal)
+ {
+ atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE);
+ /* If state_type is ATK_STATE_VISIBLE, additional notification */
+ if (state_type == ATK_STATE_VISIBLE)
+ g_signal_emit_by_name (cell, "visible_data_changed");
+ }
+
+ /* If the parent is a flyweight container cell, propagate the state
+ * change to it also
+ */
+ if (GAIL_IS_CONTAINER_CELL (parent))
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (parent), state_type, emit_signal);
+
+ return rc;
+}
+
+gboolean
+_gtk_cell_accessible_add_action (GtkCellAccessible *cell,
+ const gchar *name,
+ const gchar *description,
+ const gchar *keybinding,
+ void (*func) (GtkCellAccessible *))
+{
+ ActionInfo *info;
+
+ info = g_new (ActionInfo, 1);
+ info->name = g_strdup (name);
+ info->description = g_strdup (description);
+ info->keybinding = g_strdup (keybinding);
+ info->do_action_func = func;
+
+ cell->action_list = g_list_append (cell->action_list, info);
+
+ return TRUE;
+}
+
+gboolean
+_gtk_cell_accessible_remove_action (GtkCellAccessible *cell,
+ gint index)
+{
+ GList *l;
+
+ l = g_list_nth (cell->action_list, index);
+ if (l == NULL)
+ return FALSE;
+
+ destroy_action_info (l->data);
+ cell->action_list = g_list_remove_link (cell->action_list, l);
+
+ return TRUE;
+}
+
+
+gboolean
+_gtk_cell_accessible_remove_action_by_name (GtkCellAccessible *cell,
+ const gchar *name)
+{
+ GList *l;
+
+ for (l = cell->action_list; l; l = l->next)
+ {
+ ActionInfo *info = l->data;
+
+ if (g_strcmp0 (info->name, name) == 0)
+ break;
+ }
+
+ if (l == NULL)
+ return FALSE;
+
+ destroy_action_info (l->data);
+ cell->action_list = g_list_remove_link (cell->action_list, l);
+
+ return TRUE;
+}
+
+static ActionInfo *
+get_action_info (GtkCellAccessible *cell,
+ gint index)
+{
+ GList *l;
+
+ l = g_list_nth (cell->action_list, index);
+ if (l == NULL)
+ return NULL;
+
+ return (ActionInfo *) (l->data);
+}
+
+static gint
+gtk_cell_accessible_action_get_n_actions (AtkAction *action)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE(action);
+ if (cell->action_list != NULL)
+ return g_list_length (cell->action_list);
+ else
+ return 0;
+}
+
+static const gchar *
+gtk_cell_accessible_action_get_name (AtkAction *action,
+ gint index)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action);
+ ActionInfo *info;
+
+ info = get_action_info (cell, index);
+ if (info == NULL)
+ return NULL;
+
+ return info->name;
+}
+
+static const gchar *
+gtk_cell_accessible_action_get_description (AtkAction *action,
+ gint index)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action);
+ ActionInfo *info;
+
+ info = get_action_info (cell, index);
+ if (info == NULL)
+ return NULL;
+
+ return info->description;
+}
+
+static const gchar *
+gtk_cell_accessible_action_get_keybinding (AtkAction *action,
+ gint index)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action);
+ ActionInfo *info;
+
+ info = get_action_info (cell, index);
+ if (info == NULL)
+ return NULL;
+
+ return info->keybinding;
+}
+
+static gboolean
+gtk_cell_accessible_action_do_action (AtkAction *action,
+ gint index)
+{
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action);
+ ActionInfo *info;
+
+ info = get_action_info (cell, index);
+ if (info == NULL)
+ return FALSE;
+
+ if (info->do_action_func == NULL)
+ return FALSE;
+
+ info->do_action_func (cell);
+
+ return TRUE;
+}
+
+static void
+atk_action_interface_init (AtkActionIface *iface)
+{
+ iface->get_n_actions = gtk_cell_accessible_action_get_n_actions;
+ iface->do_action = gtk_cell_accessible_action_do_action;
+ iface->get_name = gtk_cell_accessible_action_get_name;
+ iface->get_description = gtk_cell_accessible_action_get_description;
+ iface->get_keybinding = gtk_cell_accessible_action_get_keybinding;
+}
+
+static void
+gtk_cell_accessible_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ GtkCellAccessible *cell;
+ AtkObject *parent;
+
+ cell = GTK_CELL_ACCESSIBLE (component);
+ parent = gtk_widget_get_accessible (cell->widget);
+
+ gail_cell_parent_get_cell_extents (GAIL_CELL_PARENT (parent),
+ cell, x, y, width, height, coord_type);
+}
+
+static gboolean
+gtk_cell_accessible_grab_focus (AtkComponent *component)
+{
+ GtkCellAccessible *cell;
+ AtkObject *parent;
+
+ cell = GTK_CELL_ACCESSIBLE (component);
+ parent = gtk_widget_get_accessible (cell->widget);
+
+ return gail_cell_parent_grab_focus (GAIL_CELL_PARENT (parent), cell);
+}
+
+static void
+atk_component_interface_init (AtkComponentIface *iface)
+{
+ iface->get_extents = gtk_cell_accessible_get_extents;
+ iface->grab_focus = gtk_cell_accessible_grab_focus;
+}
--- /dev/null
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_CELL_ACCESSIBLE_H__
+#define __GTK_CELL_ACCESSIBLE_H__
+
+#include <atk/atk.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CELL_ACCESSIBLE (_gtk_cell_accessible_get_type ())
+#define GTK_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessible))
+#define GTK_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessibleClass))
+#define GTK_IS_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_ACCESSIBLE))
+#define GTK_IS_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_ACCESSIBLE))
+#define GTK_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessibleClass))
+
+typedef struct _GtkCellAccessible GtkCellAccessible;
+typedef struct _GtkCellAccessibleClass GtkCellAccessibleClass;
+
+struct _GtkCellAccessible
+{
+ AtkObject parent;
+
+ GtkWidget *widget;
+ /* This cached value is used only by atk_object_get_index_in_parent()
+ * which updates the value when it is stale.
+ */
+ gint index;
+ AtkStateSet *state_set;
+ GList *action_list;
+ void (*refresh_index) (GtkCellAccessible *cell);
+};
+
+struct _GtkCellAccessibleClass
+{
+ AtkObjectClass parent_class;
+};
+
+GType _gtk_cell_accessible_get_type (void);
+
+void _gtk_cell_accessible_initialise (GtkCellAccessible *cell,
+ GtkWidget *widget,
+ AtkObject *parent,
+ gint index);
+gboolean _gtk_cell_accessible_add_state (GtkCellAccessible *cell,
+ AtkStateType state_type,
+ gboolean emit_signal);
+gboolean _gtk_cell_accessible_remove_state (GtkCellAccessible *cell,
+ AtkStateType state_type,
+ gboolean emit_signal);
+gboolean _gtk_cell_accessible_add_action (GtkCellAccessible *cell,
+ const gchar *name,
+ const gchar *description,
+ const gchar *keybinding,
+ void (*func) (GtkCellAccessible *));
+
+gboolean _gtk_cell_accessible_remove_action (GtkCellAccessible *cell,
+ gint index);
+gboolean _gtk_cell_accessible_remove_action_by_name
+ (GtkCellAccessible *cell,
+ const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GTK_CELL_ACCESSIBLE_H__ */
typedef struct _GtkTreeViewAccessibleCellInfo GtkTreeViewAccessibleCellInfo;
struct _GtkTreeViewAccessibleCellInfo
{
- GailCell *cell;
+ GtkCellAccessible *cell;
GtkTreeRowReference *cell_row_ref;
GtkTreeViewColumn *cell_col_ref;
GtkTreeViewAccessible *view;
GtkTreeViewAccessible *accessible,
gboolean emit_change_signal);
static void set_cell_visibility (GtkTreeView *tree_view,
- GailCell *cell,
+ GtkCellAccessible *cell,
GtkTreeViewColumn *tv_col,
GtkTreePath *tree_path,
gboolean emit_signal);
GtkTreeViewAccessible *accessible,
GtkTreePath *tree_path,
gboolean set_on_ancestor);
-static void set_cell_expandable (GailCell *cell);
-static void add_cell_actions (GailCell *cell,
+static void set_cell_expandable (GtkCellAccessible *cell);
+static void add_cell_actions (GtkCellAccessible *cell,
gboolean editable);
-static void toggle_cell_toggled (GailCell *cell);
-static void edit_cell (GailCell *cell);
-static void activate_cell (GailCell *cell);
+static void toggle_cell_toggled (GtkCellAccessible *cell);
+static void edit_cell (GtkCellAccessible *cell);
+static void activate_cell (GtkCellAccessible *cell);
static void cell_destroyed (gpointer data);
static void cell_info_new (GtkTreeViewAccessible *accessible,
GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeViewColumn *tv_col,
- GailCell *cell);
-static GailCell* find_cell (GtkTreeViewAccessible *accessible,
+ GtkCellAccessible *cell);
+static GtkCellAccessible *find_cell (GtkTreeViewAccessible *accessible,
gint index);
-static void refresh_cell_index (GailCell *cell);
+static void refresh_cell_index (GtkCellAccessible *cell);
static void connect_model_signals (GtkTreeView *view,
GtkTreeViewAccessible *accessible);
static void disconnect_model_signals (GtkTreeViewAccessible *accessible);
GtkTreeViewColumn **column);
static GtkTreeViewAccessibleCellInfo* find_cell_info (GtkTreeViewAccessible *view,
- GailCell *cell,
+ GtkCellAccessible *cell,
gboolean live_only);
static AtkObject * get_header_from_column (GtkTreeViewColumn *tv_col);
static gboolean idle_garbage_collect_cell_data (gpointer data);
{
GtkWidget *widget;
GtkTreeViewAccessible *accessible;
- GailCell *cell;
+ GtkCellAccessible *cell;
GtkTreeView *tree_view;
GtkTreeModel *tree_model;
GtkCellRenderer *renderer;
*/
if (renderer_list && renderer_list->next)
{
- GailCell *container_cell;
+ GtkCellAccessible *container_cell;
container = gail_container_cell_new ();
- container_cell = GAIL_CELL (container);
- gail_cell_initialise (container_cell, widget, ATK_OBJECT (accessible), i);
+ container_cell = GTK_CELL_ACCESSIBLE (container);
+ _gtk_cell_accessible_initialise (container_cell, widget, ATK_OBJECT (accessible), i);
/* The GtkTreeViewAccessibleCellInfo structure for the container will
* be before the ones for the cells so that the first one we find for
fake_renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, NULL);
child = gail_text_cell_new ();
- cell = GAIL_CELL (child);
+ cell = GTK_CELL_ACCESSIBLE (child);
renderer_cell = GAIL_RENDERER_CELL (child);
renderer_cell->renderer = fake_renderer;
/* Create the GtkTreeViewAccessibleCellInfo structure for this cell */
cell_info_new (accessible, tree_model, path, tv_col, cell);
- gail_cell_initialise (cell, widget, parent, i);
+ _gtk_cell_accessible_initialise (cell, widget, parent, i);
cell->refresh_index = refresh_cell_index;
{
set_cell_expandable (cell);
if (is_expanded)
- gail_cell_add_state (cell, ATK_STATE_EXPANDED, FALSE);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_EXPANDED, FALSE);
}
}
else
else
child = gail_renderer_cell_new ();
- cell = GAIL_CELL (child);
+ cell = GTK_CELL_ACCESSIBLE (child);
renderer_cell = GAIL_RENDERER_CELL (child);
/* Create the GtkTreeViewAccessibleCellInfo for this cell */
cell_info_new (accessible, tree_model, path, tv_col, cell);
- gail_cell_initialise (cell, widget, parent, i);
+ _gtk_cell_accessible_initialise (cell, widget, parent, i);
if (container)
gail_container_cell_add_child (container, cell);
{
set_cell_expandable (cell);
if (is_expanded)
- gail_cell_add_state (cell, ATK_STATE_EXPANDED, FALSE);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_EXPANDED, FALSE);
}
/* If the column is visible, sets the cell's state */
selection = gtk_tree_view_get_selection (tree_view);
if (gtk_tree_selection_path_is_selected (selection, path))
- gail_cell_add_state (cell, ATK_STATE_SELECTED, FALSE);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_SELECTED, FALSE);
- gail_cell_add_state (cell, ATK_STATE_FOCUSABLE, FALSE);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_FOCUSABLE, FALSE);
if (focus_index == i)
{
accessible->focus_cell = g_object_ref (cell);
- gail_cell_add_state (cell, ATK_STATE_FOCUSED, FALSE);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_FOCUSED, FALSE);
g_signal_emit_by_name (accessible, "active-descendant-changed", cell);
}
}
#define EXTRA_EXPANDER_PADDING 4
static void
-gtk_tree_view_accessible_get_cell_area (GailCellParent *parent,
- GailCell *cell,
- GdkRectangle *cell_rect)
+gtk_tree_view_accessible_get_cell_area (GailCellParent *parent,
+ GtkCellAccessible *cell,
+ GdkRectangle *cell_rect)
{
GtkWidget *widget;
GtkTreeView *tree_view;
GtkTreePath *path;
AtkObject *parent_cell;
GtkTreeViewAccessibleCellInfo *cell_info;
- GailCell *top_cell;
+ GtkCellAccessible *top_cell;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
if (widget == NULL)
tree_view = GTK_TREE_VIEW (widget);
parent_cell = atk_object_get_parent (ATK_OBJECT (cell));
if (parent_cell != ATK_OBJECT (parent))
- {
- /* GailCell is in a GailContainerCell */
- top_cell = GAIL_CELL (parent_cell);
- }
+ top_cell = GTK_CELL_ACCESSIBLE (parent_cell);
else
- {
- top_cell = cell;
- }
+ top_cell = cell;
cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), top_cell, TRUE);
if (!cell_info || !cell_info->cell_col_ref || !cell_info->cell_row_ref)
return;
}
static void
-gtk_tree_view_accessible_get_cell_extents (GailCellParent *parent,
- GailCell *cell,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
+gtk_tree_view_accessible_get_cell_extents (GailCellParent *parent,
+ GtkCellAccessible *cell,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
{
GtkWidget *widget;
GtkTreeView *tree_view;
}
static gboolean
-gtk_tree_view_accessible_grab_cell_focus (GailCellParent *parent,
- GailCell *cell)
+gtk_tree_view_accessible_grab_cell_focus (GailCellParent *parent,
+ GtkCellAccessible *cell)
{
GtkWidget *widget;
GtkTreeView *tree_view;
tv_col = cell_info->cell_col_ref;
if (parent_cell != ATK_OBJECT (parent))
{
- /* GailCell is in a GailContainerCell.
+ /* GtkCellAccessible is in a GailContainerCell.
* The GtkTreeViewColumn has multiple renderers;
* find the corresponding one.
*/
{
if (info->in_use)
{
- gail_cell_remove_state (info->cell, ATK_STATE_SELECTED, TRUE);
+ _gtk_cell_accessible_remove_state (info->cell, ATK_STATE_SELECTED, TRUE);
path = gtk_tree_row_reference_get_path (info->cell_row_ref);
if (path && gtk_tree_selection_path_is_selected (tree_selection, path))
- gail_cell_add_state (info->cell, ATK_STATE_SELECTED, TRUE);
+ _gtk_cell_accessible_add_state (info->cell, ATK_STATE_SELECTED, TRUE);
gtk_tree_path_free (path);
}
}
{
if (accessible->focus_cell)
{
- gail_cell_remove_state (GAIL_CELL (accessible->focus_cell), ATK_STATE_ACTIVE, FALSE);
- gail_cell_remove_state (GAIL_CELL (accessible->focus_cell), ATK_STATE_FOCUSED, FALSE);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (accessible->focus_cell), ATK_STATE_ACTIVE, FALSE);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (accessible->focus_cell), ATK_STATE_FOCUSED, FALSE);
g_object_unref (accessible->focus_cell);
accessible->focus_cell = cell;
}
if (gtk_widget_has_focus (widget))
{
- gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_ACTIVE, FALSE);
- gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_FOCUSED, FALSE);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_ACTIVE, FALSE);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_FOCUSED, FALSE);
}
g_signal_emit_by_name (accessible, "active-descendant-changed", cell);
{
if (!atk_state_set_contains_state (state_set, ATK_STATE_FOCUSED))
{
- gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_ACTIVE, FALSE);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_ACTIVE, FALSE);
accessible->focus_cell = cell;
- gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_FOCUSED, FALSE);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_FOCUSED, FALSE);
g_signal_emit_by_name (accessible, "active-descendant-changed", cell);
}
g_object_unref (state_set);
accessible = GTK_TREE_VIEW_ACCESSIBLE (gtk_widget_get_accessible (widget));
if (accessible->focus_cell)
- {
- gail_cell_remove_state (GAIL_CELL (accessible->focus_cell), ATK_STATE_ACTIVE, FALSE);
- gail_cell_remove_state (GAIL_CELL (accessible->focus_cell), ATK_STATE_FOCUSED, FALSE);
- g_object_unref (accessible->focus_cell);
- accessible->focus_cell = NULL;
- }
+ {
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (accessible->focus_cell), ATK_STATE_ACTIVE, FALSE);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (accessible->focus_cell), ATK_STATE_FOCUSED, FALSE);
+ g_object_unref (accessible->focus_cell);
+ accessible->focus_cell = NULL;
+ }
return FALSE;
}
tv_col, row_path, FALSE);
else
{
- gail_cell_remove_state (cell_info->cell, ATK_STATE_VISIBLE, TRUE);
- gail_cell_remove_state (cell_info->cell, ATK_STATE_SHOWING, TRUE);
+ _gtk_cell_accessible_remove_state (cell_info->cell, ATK_STATE_VISIBLE, TRUE);
+ _gtk_cell_accessible_remove_state (cell_info->cell, ATK_STATE_SHOWING, TRUE);
}
}
gtk_tree_path_free (row_path);
static void
set_cell_visibility (GtkTreeView *tree_view,
- GailCell *cell,
+ GtkCellAccessible *cell,
GtkTreeViewColumn *tv_col,
GtkTreePath *tree_path,
gboolean emit_signal)
/* The height will be zero for a cell for which an antecedent
* is not expanded
*/
- gail_cell_add_state (cell, ATK_STATE_VISIBLE, emit_signal);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_VISIBLE, emit_signal);
if (is_cell_showing (tree_view, &cell_rect))
- gail_cell_add_state (cell, ATK_STATE_SHOWING, emit_signal);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_SHOWING, emit_signal);
else
- gail_cell_remove_state (cell, ATK_STATE_SHOWING, emit_signal);
+ _gtk_cell_accessible_remove_state (cell, ATK_STATE_SHOWING, emit_signal);
}
else
{
- gail_cell_remove_state (cell, ATK_STATE_VISIBLE, emit_signal);
- gail_cell_remove_state (cell, ATK_STATE_SHOWING, emit_signal);
+ _gtk_cell_accessible_remove_state (cell, ATK_STATE_VISIBLE, emit_signal);
+ _gtk_cell_accessible_remove_state (cell, ATK_STATE_SHOWING, emit_signal);
}
}
GParamSpec *spec;
GailRendererCellClass *gail_renderer_cell_class;
GtkCellRendererClass *gtk_cell_renderer_class;
- GailCell *cell;
+ GtkCellAccessible *cell;
gchar **prop_list;
AtkObject *parent;
gboolean is_expander, is_expanded;
prop_list = gail_renderer_cell_class->property_list;
- cell = GAIL_CELL (renderer_cell);
+ cell = GTK_CELL_ACCESSIBLE (renderer_cell);
cell_info = find_cell_info (accessible, cell, TRUE);
if (!cell_info || !cell_info->cell_col_ref || !cell_info->cell_row_ref)
return FALSE;
{
obj = G_OBJECT (cell_info->cell);
- gail_cell_add_state (cell_info->cell, ATK_STATE_DEFUNCT, FALSE);
+ _gtk_cell_accessible_add_state (cell_info->cell, ATK_STATE_DEFUNCT, FALSE);
g_object_weak_unref (obj, (GWeakNotify) cell_destroyed, cell_info);
cell_info->in_use = FALSE;
if (!accessible->garbage_collection_pending)
if (act_on_cell && cell_info->in_use)
{
if (set_stale)
- gail_cell_add_state (cell_info->cell, ATK_STATE_STALE, TRUE);
+ _gtk_cell_accessible_add_state (cell_info->cell, ATK_STATE_STALE, TRUE);
set_cell_visibility (GTK_TREE_VIEW (widget),
cell_info->cell,
cell_info->cell_col_ref,
if (cell_path != NULL)
{
- GailCell *cell = GAIL_CELL (cell_info->cell);
+ GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (cell_info->cell);
expander_tv = gtk_tree_view_get_expander_column (tree_view);
set_cell_expandable (cell);
if (gtk_tree_view_row_expanded (tree_view, cell_path))
- gail_cell_add_state (cell, ATK_STATE_EXPANDED, TRUE);
+ _gtk_cell_accessible_add_state (cell, ATK_STATE_EXPANDED, TRUE);
else
- gail_cell_remove_state (cell, ATK_STATE_EXPANDED, TRUE);
+ _gtk_cell_accessible_remove_state (cell, ATK_STATE_EXPANDED, TRUE);
}
else
{
- gail_cell_remove_state (cell, ATK_STATE_EXPANDED, TRUE);
- if (gail_cell_remove_state (cell, ATK_STATE_EXPANDABLE, TRUE))
+ _gtk_cell_accessible_remove_state (cell, ATK_STATE_EXPANDED, TRUE);
+ if (_gtk_cell_accessible_remove_state (cell, ATK_STATE_EXPANDABLE, TRUE))
/* The state may have been propagated to the container cell */
if (!GAIL_IS_CONTAINER_CELL (cell))
- gail_cell_remove_action_by_name (cell,
- "expand or contract");
+ _gtk_cell_accessible_remove_action_by_name (cell,
+ "expand or contract");
}
/* We assume that each cell in the cache once and
}
static void
-add_cell_actions (GailCell *cell,
- gboolean editable)
+add_cell_actions (GtkCellAccessible *cell,
+ gboolean editable)
{
if (GAIL_IS_BOOLEAN_CELL (cell))
- gail_cell_add_action (cell,
- "toggle", "toggles the cell",
- NULL, toggle_cell_toggled);
+ _gtk_cell_accessible_add_action (cell,
+ "toggle", "toggles the cell",
+ NULL, toggle_cell_toggled);
if (editable)
- gail_cell_add_action (cell,
- "edit", "creates a widget in which the contents of the cell can be edited",
- NULL, edit_cell);
- gail_cell_add_action (cell,
- "activate", "activate the cell",
- NULL, activate_cell);
+ _gtk_cell_accessible_add_action (cell,
+ "edit", "creates a widget in which the contents of the cell can be edited",
+ NULL, edit_cell);
+ _gtk_cell_accessible_add_action (cell,
+ "activate", "activate the cell",
+ NULL, activate_cell);
}
static void
-toggle_cell_expanded (GailCell *cell)
+toggle_cell_expanded (GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreeView *tree_view;
}
static void
-toggle_cell_toggled (GailCell *cell)
+toggle_cell_toggled (GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreePath *path;
}
static void
-edit_cell (GailCell *cell)
+edit_cell (GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreeView *tree_view;
}
static void
-activate_cell (GailCell *cell)
+activate_cell (GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreeView *tree_view;
GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeViewColumn *tv_col,
- GailCell *cell)
+ GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *cell_info;
g_object_weak_ref (G_OBJECT (cell), (GWeakNotify) cell_destroyed, cell_info);
}
-static GailCell *
+static GtkCellAccessible *
find_cell (GtkTreeViewAccessible *accessible,
gint index)
{
}
static void
-refresh_cell_index (GailCell *cell)
+refresh_cell_index (GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *info;
AtkObject *parent;
}
static void
-set_cell_expandable (GailCell *cell)
+set_cell_expandable (GtkCellAccessible *cell)
{
- if (gail_cell_add_state (cell, ATK_STATE_EXPANDABLE, FALSE))
- gail_cell_add_action (cell,
- "expand or contract",
- "expands or contracts the row in the tree view containing this cell",
- NULL, toggle_cell_expanded);
+ if (_gtk_cell_accessible_add_state (cell, ATK_STATE_EXPANDABLE, FALSE))
+ _gtk_cell_accessible_add_action (cell,
+ "expand or contract",
+ "expands or contracts the row in the tree view containing this cell",
+ NULL, toggle_cell_expanded);
}
static GtkTreeViewAccessibleCellInfo *
find_cell_info (GtkTreeViewAccessible *accessible,
- GailCell *cell,
+ GtkCellAccessible *cell,
gboolean live_only)
{
GtkTreeViewAccessibleCellInfo *cell_info;
#include <gtk/gtk.h>
#include "gtkcontaineraccessible.h"
-#include "gailcell.h"
G_BEGIN_DECLS